rm(list=ls())

library("ggplot2")
library("gridExtra")
library("stargazer")

source("00_Functions_All.R")
set.seed(123)

experiment1 <- read.csv("experiment2022.csv")
experiment2 <- read.csv("experiment2023.csv")

# --------------------------------------------------
# Table A1
# --------------------------------------------------
# Experiment 1
# Gender
a1.1 <- paste(round(rev(table(experiment1$Female)/nrow(experiment1)) * 100, 1), "%", sep = "")
# Region
# Combining south & central regions, and north & northeast regions
experiment1$Region4 <- ifelse(experiment1$Region %in% c(2, 4), 2, 
                              ifelse(experiment1$Region %in% c(3, 5), 3, experiment1$Region))
a1.2 <- paste(round(table(experiment1$Region4)/nrow(experiment1) * 100, 1), "%", sep = "")
# Age Group
# Combining age groups <=29, and age groups >= 40
experiment1$Age_Group3 <- ifelse(experiment1$Age_Group %in% c(1,2), 1, 
                                 ifelse(experiment1$Age_Group == 3, 2, 3))
a1.3 <- paste(round(table(experiment1$Age_Group3)/nrow(experiment1) * 100, 1), "%", sep = "")
# Education
a1.4 <- paste(round(table(experiment1$Education)/nrow(experiment1) * 100, 1), "%", sep = "")
a1.s1 <- c(a1.1,a1.2,a1.3,a1.4)

# Experiment 2
# Gender
a1.5 <- paste(round(rev(table(experiment2$Female)/nrow(experiment2)) * 100, 1), "%", sep = "")
# Region
# Combining south & central regions, and north & northeast regions
experiment2$Region4 <- ifelse(experiment2$Region %in% c(2, 4), 2, 
                              ifelse(experiment2$Region %in% c(3, 5), 3, experiment2$Region))
a1.6 <- paste(round(table(experiment2$Region4)/nrow(experiment2) * 100, 1), "%", sep = "")
# Age Group
# Combining age groups <=29, and age groups >= 40
experiment2$Age_Group3 <- ifelse(experiment2$Age_Group %in% c(1,2,3), 1, 
                                 ifelse(experiment2$Age_Group %in% c(4,5), 2,
                                        ifelse(experiment2$Age_Group %in% c(6,7,8), 3, NA)))
a1.7 <- paste(round(table(experiment2$Age_Group3)/nrow(experiment2) * 100, 1), "%", sep = "")
# Education
a1.8 <- paste(round(table(experiment2$Education)/nrow(experiment2) * 100, 1), "%", sep = "")
a1.s2 <- c(a1.5,a1.6,a1.7,a1.8)

# China Internet Census ()
# Gender
a1.9 <- paste(c(0.473,0.527) * 100, "%", sep = "")
# Region
a1.10 <- paste(c(0.311,0.282,0.222,0.185) * 100, "%", sep = "")
# Age Group
a1.11 <- paste(c(0.484,0.235,0.281) * 100, "%", sep = "")
# Education
a1.12 <- paste(c(0.561,0.238,0.105,0.097) * 100, "%", sep = "")
a1.c <- c(a1.9,a1.10,a1.11,a1.12)


table.A1 <- cbind(a1.s1,a1.s2,a1.c)
colnames(table.A1) <- c("Study 1", "Study 2", "China Internet Census")
rownames(table.A1) <- c("Gender: Female", "Gender: Male",
                        "Region: East", "Region: South & Central", "Region: North & Northeast", "Region: West",
                        "Age: <=29", "Age: 30-39", "Age: >=40",
                        "Education: <= Junior High", "Education: Senior High", "Education: 3-year College", "Education: >= 4-year College")
table.A1

# --------------------------------------------------
# Table A2
# --------------------------------------------------
# Balance Check
# Age Group
a2.1 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment1$Age_Group, experiment1$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Age_Group ~ RussianGroup, data = experiment1))[[1]]$"Pr(>F)"[1],2))
# Female
a2.2 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment1$Female, experiment1$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Female ~ RussianGroup, data = experiment1))[[1]]$"Pr(>F)"[1],2))
# Education
a2.3 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment1$Education, experiment1$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Education ~ RussianGroup, data = experiment1))[[1]]$"Pr(>F)"[1],2))
# Party Member
a2.4 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment1$PartyMember, experiment1$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(PartyMember ~ RussianGroup, data = experiment1))[[1]]$"Pr(>F)"[1],2))
# Political Interest
a2.5 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment1$Pol_Interest, experiment1$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Pol_Interest ~ RussianGroup, data = experiment1))[[1]]$"Pr(>F)"[1],2))
# Ideology
a2.6 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment1$Ideology, experiment1$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Ideology ~ RussianGroup, data = experiment1))[[1]]$"Pr(>F)"[1],2))
# Nationalism
a2.7 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment1$Nationalism, experiment1$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Nationalism ~ RussianGroup, data = experiment1))[[1]]$"Pr(>F)"[1],2))
# Social Media
a2.8 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment1$Social_Media, experiment1$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Social_Media ~ RussianGroup, data = experiment1))[[1]]$"Pr(>F)"[1],2))
# Foreign Link
a2.9 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment1$Foreign, experiment1$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Foreign ~ RussianGroup, data = experiment1))[[1]]$"Pr(>F)"[1],2))
# Number of Observation
a2.10 <- c(table(experiment1$Group),"")


table.A2 <- rbind(a2.1,a2.2,a2.3,a2.4,a2.5,a2.6,a2.7,a2.8,a2.9,a2.10)
colnames(table.A2) <- c("Control Group", "Invasion", "Economic Measures","Military Measures", "Lack Military Measures", "F-test p-value")
rownames(table.A2) <- c("Age Group", "Female", "Education", "Party Member", "Pol Interests", "Ideology",
                        "Nationalism", "Social Media", "Foreign Links", "N")
table.A2


# --------------------------------------------------
# Table A3
# --------------------------------------------------
# Balance Check
# Age Group
a3.1 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment2$Age_Group, experiment2$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Age_Group ~ RussianGroup, data = experiment2))[[1]]$"Pr(>F)"[1],2))
# Female
a3.2 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment2$Female, experiment2$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Female ~ RussianGroup, data = experiment2))[[1]]$"Pr(>F)"[1],2))
# Education
a3.3 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment2$Education, experiment2$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Education ~ RussianGroup, data = experiment2))[[1]]$"Pr(>F)"[1],2))
# Party Member
a3.4 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment2$PartyMember, experiment2$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(PartyMember ~ RussianGroup, data = experiment2))[[1]]$"Pr(>F)"[1],2))
# Political Interest
a3.5 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment2$Pol_Interest, experiment2$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Pol_Interest ~ RussianGroup, data = experiment2))[[1]]$"Pr(>F)"[1],2))
# Ideology
a3.6 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment2$Ideology, experiment2$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Ideology ~ RussianGroup, data = experiment2))[[1]]$"Pr(>F)"[1],2))
# Nationalism
a3.7 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment2$Nationalism, experiment2$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Nationalism ~ RussianGroup, data = experiment2))[[1]]$"Pr(>F)"[1],2))
# Social Media
a3.8 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment2$Social_Media, experiment2$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Social_Media ~ RussianGroup, data = experiment2))[[1]]$"Pr(>F)"[1],2))
# Foreign Link
a3.9 <- c(
  # Group Mean with Missing Values
  round(tapply(experiment2$Foreign, experiment2$Group, mean, na.rm = TRUE),2),
  # F-test p-value
  round(summary(aov(Foreign ~ RussianGroup, data = experiment2))[[1]]$"Pr(>F)"[1],2))
# Number of Observation
a3.10 <- c(table(experiment2$Group),"")


table.A3 <- rbind(a3.1,a3.2,a3.3,a3.4,a3.5,a3.6,a3.7,a3.8,a3.9,a3.10)
colnames(table.A3) <- c("Control Group", "Invasion", "Economic Measures","Military Measures", "F-test p-value")
rownames(table.A3) <- c("Age Group", "Female", "Education", "Party Member", "Political Interests", "Ideology",
                        "Nationalism", "Social Media Usage", "Foreign Links", "N")
table.A3

# --------------------------------------------------
# Figure B1
# --------------------------------------------------
pdf(file = "./Figures_Appendix/Figure_B01.pdf", width = 17, height = 6)
main.result.app(data1 = experiment1, data2 = experiment2, plot.covs = FALSE)
dev.off()

# --------------------------------------------------
# Figure B2
# --------------------------------------------------
pdf(file = "./Figures_Appendix/Figure_B02.pdf", width = 17, height = 6)
main.result.inva.app(data1 = experiment1, data2 = experiment2, plot.covs = FALSE)
dev.off()

# --------------------------------------------------
# Figure B3
# --------------------------------------------------
pdf(file = "./Figures_Appendix/Figure_B03.pdf", width = 22, height = 12)
main.result.taiwan(data = experiment2, plot.covs = TRUE, paper = FALSE, title.l = "", title.r = "")
dev.off()

# --------------------------------------------------
# Figure B4
# --------------------------------------------------
Experiment <- experiment1[(experiment1$Group %in% c(0,1)),]

# Define subsets of data for each heterogenous treatment effect
# For experiment in 2022
subsets <- list(
  Experiment$Female == 0,
  Experiment$Female == 1,
  Experiment$Education %in% c(1,2),
  Experiment$Education == 3,
  Experiment$Education %in% c(4,5),
  Experiment$Age_Group %in% c(1,2),
  Experiment$Age_Group %in% c(3),
  Experiment$Age_Group %in% c(4,5),
  Experiment$Nationalism %in% c(1,2),
  Experiment$Nationalism == 3,
  Experiment$Nationalism %in% c(4,5),
  Experiment$Ideology %in% c(1,2),
  Experiment$Ideology == 3,
  Experiment$Ideology %in% c(4,5),
  Experiment$Region %in% c(1,2),
  Experiment$Region %in% c(3,4,5,6)
)

# Run a linear regression for each heterogenous treatment effect
# Support for the Use of Force
models.1 <- lapply(subsets, function(subset) {
  lm(Military ~ Group, data = Experiment[subset,])
})
# Support for Invading Taiwan
models.2 <- lapply(subsets, function(subset) {
  lm(Taiwan ~ Group, data = Experiment[subset,])
})

# Create a vector of terms for the coefficients
Terms <- c("Male", "Female", "High school", "3-year college", "4-year college",
           "Age < 30", "Age in 30-40", "Age > 40", "Nationalism Low", "Nationalism Med", "Nationalism High",
           "Liberal", "Moderate", "Conservative", "Coastal Region", "Inner Region")

# Extract the coefficient estimates and standard errors for each model
# Support for the Use of Force
Estimates.1 <- sapply(models.1, function(model) coef(summary(model))["Group", "Estimate"])
Std_Error.1 <- sapply(models.1, function(model) coef(summary(model))["Group", "Std. Error"])
# Support for Invading Taiwan
Estimates.2 <- sapply(models.2, function(model) coef(summary(model))["Group", "Estimate"])
Std_Error.2 <- sapply(models.2, function(model) coef(summary(model))["Group", "Std. Error"])

# Create a data frame of the results
# Support for the Use of Force
plot.data.1 <- data.frame(Terms = Terms, Estimates = Estimates.1, Std_Error = Std_Error.1)
# Support for Invading Taiwan
plot.data.2 <- data.frame(Terms = Terms, Estimates = Estimates.2, Std_Error = Std_Error.2)

# Add ymin and ymax for plotting purposes
multiplier <- 1.96
plot.data.1$ymin <- plot.data.1$Estimates - (multiplier * plot.data.1$Std_Error)
plot.data.1$ymax <- plot.data.1$Estimates + (multiplier * plot.data.1$Std_Error)
plot.data.2$ymin <- plot.data.2$Estimates - (multiplier * plot.data.2$Std_Error)
plot.data.2$ymax <- plot.data.2$Estimates + (multiplier * plot.data.2$Std_Error)

# Reverse the order of the terms
plot.data.1$Terms <- factor(plot.data.1$Terms, levels = rev(plot.data.1$Terms), ordered = TRUE)
plot.data.2$Terms <- factor(plot.data.2$Terms, levels = rev(plot.data.2$Terms), ordered = TRUE)

# Plot the results using ggplot2
# Support for Use of Force
Figure.B4.1 <- ggplot(plot.data.1, aes(x = Terms, y = Estimates)) +
  geom_hline(yintercept = 0, colour = "#8C2318", size = 1) +
  geom_pointrange(aes(ymin = ymin, ymax = ymax)) +
  labs(y = "Coefficient of Estimates", x = "", title = "Support for Use of Force") +
  coord_flip() +
  theme_bw() +
  theme(axis.text.x = element_text(size = 12, face = "bold"),
        axis.text.y = element_text(size = 12, face = "bold")) 
# Support for Invading Taiwan
Figure.B4.2 <- ggplot(plot.data.2, aes(x = Terms, y = Estimates)) +
  geom_hline(yintercept = 0, colour = "#8C2318", size = 1) +
  geom_pointrange(aes(ymin = ymin, ymax = ymax)) +
  labs(y = "Coefficient of Estimates", x = "", title = "Support for Invading Taiwan") +
  coord_flip() +
  theme_bw() +
  theme(axis.text.x = element_text(size = 12, face = "bold"),
        axis.text.y = element_text(size = 12, face = "bold")) 

Figure.B4 <- grid.arrange(Figure.B4.1,Figure.B4.2, ncol=2)
ggsave(Figure.B4, file = "./Figures_Appendix/Figure_B04.pdf", width = 9, height = 6.5)

# --------------------------------------------------
# Figure B5
# --------------------------------------------------
Experiment <- experiment2[(experiment2$Group %in% c(0,1)),]

# Define subsets of data for each heterogenous treatment effect
# For experiment in 2023
subsets <- list(
  Experiment$Female == 0,
  Experiment$Female == 1,
  Experiment$Education %in% c(1,2),
  Experiment$Education == 3,
  Experiment$Education %in% c(4,5),
  Experiment$Age_Group %in% c(1,2,3),
  Experiment$Age_Group %in% c(4,5),
  Experiment$Age_Group %in% c(6,7,8),
  Experiment$Nationalism %in% c(1,2),
  Experiment$Nationalism == 3,
  Experiment$Nationalism %in% c(4,5),
  Experiment$Ideology %in% c(1,2),
  Experiment$Ideology == 3,
  Experiment$Ideology %in% c(4,5),
  Experiment$Region %in% c(1,2),
  Experiment$Region %in% c(3,4,5,6)
)

# Run a linear regression for each heterogenous treatment effect
# Support for the Use of Force
models.1 <- lapply(subsets, function(subset) {
  lm(Military ~ Group, data = Experiment[subset,])
})
# Support for Invading Taiwan
models.2 <- lapply(subsets, function(subset) {
  lm(Taiwan ~ Group, data = Experiment[subset,])
})

# Create a vector of terms for the coefficients
Terms <- c("Male", "Female", "High school", "3-year college", "4-year college",
           "Age < 30", "Age in 30-40", "Age > 40", "Nationalism Low", "Nationalism Med", "Nationalism High",
           "Liberal", "Moderate", "Conservative", "Coastal Region", "Inner Region")

# Extract the coefficient estimates and standard errors for each model
# Support for the Use of Force
Estimates.1 <- sapply(models.1, function(model) coef(summary(model))["Group", "Estimate"])
Std_Error.1 <- sapply(models.1, function(model) coef(summary(model))["Group", "Std. Error"])
# Support for Invading Taiwan
Estimates.2 <- sapply(models.2, function(model) coef(summary(model))["Group", "Estimate"])
Std_Error.2 <- sapply(models.2, function(model) coef(summary(model))["Group", "Std. Error"])

# Create a data frame of the results
# Support for the Use of Force
plot.data.1 <- data.frame(Terms = Terms, Estimates = Estimates.1, Std_Error = Std_Error.1)
# Support for Invading Taiwan
plot.data.2 <- data.frame(Terms = Terms, Estimates = Estimates.2, Std_Error = Std_Error.2)

# Add ymin and ymax for plotting purposes
multiplier <- 1.96
plot.data.1$ymin <- plot.data.1$Estimates - (multiplier * plot.data.1$Std_Error)
plot.data.1$ymax <- plot.data.1$Estimates + (multiplier * plot.data.1$Std_Error)
plot.data.2$ymin <- plot.data.2$Estimates - (multiplier * plot.data.2$Std_Error)
plot.data.2$ymax <- plot.data.2$Estimates + (multiplier * plot.data.2$Std_Error)

# Reverse the order of the terms
plot.data.1$Terms <- factor(plot.data.1$Terms, levels = rev(plot.data.1$Terms), ordered = TRUE)
plot.data.2$Terms <- factor(plot.data.2$Terms, levels = rev(plot.data.2$Terms), ordered = TRUE)

# Plot the results using ggplot2
# Support for Use of Force
Figure.B5.1 <- ggplot(plot.data.1, aes(x = Terms, y = Estimates)) +
  geom_hline(yintercept = 0, colour = "#8C2318", size = 1) +
  geom_pointrange(aes(ymin = ymin, ymax = ymax)) +
  labs(y = "Coefficient of Estimates", x = "", title = "Support for Use of Force") +
  coord_flip() +
  theme_bw() +
  theme(axis.text.x = element_text(size = 12, face = "bold"),
        axis.text.y = element_text(size = 12, face = "bold")) 
# Support for Invading Taiwan
Figure.B5.2 <- ggplot(plot.data.2, aes(x = Terms, y = Estimates)) +
  geom_hline(yintercept = 0, colour = "#8C2318", size = 1) +
  geom_pointrange(aes(ymin = ymin, ymax = ymax)) +
  labs(y = "Coefficient of Estimates", x = "", title = "Support for Invading Taiwan") +
  coord_flip() +
  theme_bw() +
  theme(axis.text.x = element_text(size = 12, face = "bold"),
        axis.text.y = element_text(size = 12, face = "bold")) 

Figure.B5 <- grid.arrange(Figure.B5.1,Figure.B5.2, ncol=2)
ggsave(Figure.B5, file = "./Figures_Appendix/Figure_B05.pdf", width = 9, height = 6.5)

# --------------------------------------------------
# Table B1
# --------------------------------------------------
# Treatment effects with weights (Study 1)
lm.B1.1 <- lm(Military ~ as.factor(Group), data = experiment1, weights = calibWeight)
lm.B1.2 <- lm(Military ~ as.factor(Group) + Female + Age_Group + Education + PartyMember + Pol_Interest
              + Ideology + Nationalism + Social_Media + Foreign, data = experiment1, weights = calibWeight)
lm.B1.3 <- lm(Taiwan ~ as.factor(Group), data = experiment1, weights = calibWeight)
lm.B1.4 <- lm(Taiwan ~ as.factor(Group) + Female + Age_Group + Education + PartyMember + Pol_Interest
              + Ideology + Nationalism + Social_Media + Foreign, data = experiment1, weights = calibWeight)

stargazer(lm.B1.1, lm.B1.2, lm.B1.3, lm.B1.4, 
          style = "APSR",
          covariate.labels = c("Invasion", "Economic Measures", "Military Measures", "Lack of Military Measures"))


# --------------------------------------------------
# Table B2
# --------------------------------------------------
# Treatment effects with weights (Study 2)
lm.B2.1 <- lm(Military ~ as.factor(Group), data = experiment2, weights = calibWeight)
lm.B2.2 <- lm(Military ~ as.factor(Group) + Female + Age_Group + Education + PartyMember + Pol_Interest
              + Ideology + Nationalism + Social_Media + Foreign, data = experiment2, weights = calibWeight)
lm.B2.3 <- lm(Taiwan ~ as.factor(Group), data = experiment2, weights = calibWeight)
lm.B2.4 <- lm(Taiwan ~ as.factor(Group) + Female + Age_Group + Education + PartyMember + Pol_Interest
              + Ideology + Nationalism + Social_Media + Foreign, data = experiment2, weights = calibWeight)

stargazer(lm.B2.1, lm.B2.2, lm.B2.3, lm.B2.4, 
          style = "APSR",
          covariate.labels = c("Invasion", "Economic Measures", "Military Measures"))



# --------------------------------------------------
# Table B3
# --------------------------------------------------
experiment1 <- experiment1[experiment1$Group != 4, ]

# Main Regressions:
# Outcome: Support for the Use of Force
main1_s1 <- lm(Military ~ as.factor(RussianGroup), data = experiment1)
main1_s2 <- lm(Military ~ as.factor(RussianGroup), data = experiment2)

# Outcome: Support for the Use of Force Against Taiwan
main2_s1 <- lm(Taiwan ~ as.factor(RussianGroup), data = experiment1)
main2_s2 <- lm(Taiwan ~ as.factor(RussianGroup), data = experiment2)

# Subset the data to exclude the control group
# Invasion Treatment becomes the baseline
data.sub1 <- experiment1[!(experiment1$Group %in% 0), ]    
data.sub2 <- experiment2[!(experiment2$Group %in% 0), ]    

# Regressions with Invasion Treatment as baseline:
# Outcome: Support for the Use of Force
main1_s1_inv <- lm(Military ~ as.factor(RussianGroup), data = data.sub1)
main1_s2_inv <- lm(Military ~ as.factor(RussianGroup), data = data.sub2)

# Outcome: Support for the Use of Force Against Taiwan
main2_s1_inv <- lm(Taiwan ~ as.factor(RussianGroup), data = data.sub1)
main2_s2_inv <- lm(Taiwan ~ as.factor(RussianGroup), data = data.sub2)

# Regressions for the Taiwan Questions used in Figure 3
# We need them to adjust the p-values 
main3a_s2 <- lm(Taiwan_Invasion ~ as.factor(RussianGroup), data = experiment2)
main3b_s2 <- lm(Taiwan_Coersion ~ as.factor(RussianGroup), data = experiment2)

adj.p.s1 <- p.adjust(c(summary(main1_s1)$coefficients[2:4,4], summary(main1_s1_inv)$coefficients[2:3,4], summary(main2_s1)$coefficients[2:4,4], summary(main2_s1_inv)$coefficients[2:3,4]), method = "bonferroni")
adj.p.s2 <- p.adjust(c(summary(main1_s2)$coefficients[2:4,4], summary(main1_s2_inv)$coefficients[2:3,4], summary(main2_s2)$coefficients[2:4,4], summary(main2_s2_inv)$coefficients[2:3,4], summary(main3a_s2)$coefficients[2:4,4], summary(main3b_s2)$coefficients[2:4,4]), method = "bonferroni")

# Table B3 Panel A
c1 <- round(c(coef(main1_s1)["as.factor(RussianGroup)Invasion"], coef(main2_s1)["as.factor(RussianGroup)Invasion"],
              coef(main1_s2)["as.factor(RussianGroup)Invasion"], coef(main2_s2)["as.factor(RussianGroup)Invasion"]), 2)
p1 <- round(c(summary(main1_s1)$coefficients["as.factor(RussianGroup)Invasion", 4], summary(main2_s1)$coefficients["as.factor(RussianGroup)Invasion", 4],
              summary(main1_s2)$coefficients["as.factor(RussianGroup)Invasion", 4], summary(main2_s2)$coefficients["as.factor(RussianGroup)Invasion", 4]), 4)
a1 <- round(c(adj.p.s1[names(adj.p.s1) %in% "as.factor(RussianGroup)Invasion"][1], adj.p.s1[names(adj.p.s1) %in% "as.factor(RussianGroup)Invasion"][2],
              adj.p.s2[names(adj.p.s2) %in% "as.factor(RussianGroup)Invasion"][1], adj.p.s2[names(adj.p.s2) %in% "as.factor(RussianGroup)Invasion"][2]), 4)     

c2 <- round(c(coef(main1_s1)["as.factor(RussianGroup)Sanction"], coef(main2_s1)["as.factor(RussianGroup)Sanction"],
              coef(main1_s2)["as.factor(RussianGroup)Sanction"], coef(main2_s2)["as.factor(RussianGroup)Sanction"]), 2)
p2 <- round(c(summary(main1_s1)$coefficients["as.factor(RussianGroup)Sanction", 4], summary(main2_s1)$coefficients["as.factor(RussianGroup)Sanction", 4],
              summary(main1_s2)$coefficients["as.factor(RussianGroup)Sanction", 4], summary(main2_s2)$coefficients["as.factor(RussianGroup)Sanction", 4]), 4)
a2 <- round(c(adj.p.s1[names(adj.p.s1) %in% "as.factor(RussianGroup)Sanction"][1], adj.p.s1[names(adj.p.s1) %in% "as.factor(RussianGroup)Sanction"][3],
              adj.p.s2[names(adj.p.s2) %in% "as.factor(RussianGroup)Sanction"][1], adj.p.s2[names(adj.p.s2) %in% "as.factor(RussianGroup)Sanction"][3]), 4)     

c3 <- round(c(coef(main1_s1)["as.factor(RussianGroup)Military"], coef(main2_s1)["as.factor(RussianGroup)Military"],
              coef(main1_s2)["as.factor(RussianGroup)Military"], coef(main2_s2)["as.factor(RussianGroup)Military"]), 2)
p3 <- round(c(summary(main1_s1)$coefficients["as.factor(RussianGroup)Military", 4], summary(main2_s1)$coefficients["as.factor(RussianGroup)Military", 4],
              summary(main1_s2)$coefficients["as.factor(RussianGroup)Military", 4], summary(main2_s2)$coefficients["as.factor(RussianGroup)Military", 4]), 4)
a3 <- round(c(adj.p.s1[names(adj.p.s1) %in% "as.factor(RussianGroup)Military"][1], adj.p.s1[names(adj.p.s1) %in% "as.factor(RussianGroup)Military"][3],
              adj.p.s2[names(adj.p.s2) %in% "as.factor(RussianGroup)Military"][1], adj.p.s2[names(adj.p.s2) %in% "as.factor(RussianGroup)Military"][3]), 4)     

meansB3A <- round(c(mean(experiment1$Military[experiment1$Group == 0], na.rm = TRUE), mean(experiment1$Taiwan[experiment1$Group == 0], na.rm = TRUE),
                    mean(experiment2$Military[experiment2$Group == 0], na.rm = TRUE), mean(experiment2$Taiwan[experiment2$Group == 0], na.rm = TRUE)), 2)
nB3A <- c(nrow(experiment1), NA,
          nrow(experiment2), NA)

table.B3A <- rbind(c1, p1, a1,
                   c2, p2, a2, 
                   c3, p3, a3,
                   meansB3A, nB3A)
colnames(table.B3A) <- c("Experiment 1: Use of Force", "Experiment 1: Use of Force Against Taiwan",
                         "Experiment 2: Use of Force", "Experiment 2: Use of Force Against Taiwan")
rownames(table.B3A) <- c("Invasion", "p-value", "adjusted p-value",
                         "Economic Measures", "p-value", "adjusted p-value",
                         "Military Measures", "p-value", "adjusted p-value",
                         "Baseline Support", "N")

# Table B3 Panel B
c4 <- round(c(coef(main1_s1_inv)["as.factor(RussianGroup)Sanction"], coef(main2_s1_inv)["as.factor(RussianGroup)Sanction"],
              coef(main1_s2_inv)["as.factor(RussianGroup)Sanction"], coef(main2_s2_inv)["as.factor(RussianGroup)Sanction"]), 2)
p4 <- round(c(summary(main1_s1_inv)$coefficients["as.factor(RussianGroup)Sanction", 4], summary(main2_s1_inv)$coefficients["as.factor(RussianGroup)Sanction", 4],
              summary(main1_s2_inv)$coefficients["as.factor(RussianGroup)Sanction", 4], summary(main2_s2_inv)$coefficients["as.factor(RussianGroup)Sanction", 4]), 4)
a4 <- round(c(adj.p.s1[names(adj.p.s1) %in% "as.factor(RussianGroup)Sanction"][2], adj.p.s1[names(adj.p.s1) %in% "as.factor(RussianGroup)Sanction"][4],
              adj.p.s2[names(adj.p.s1) %in% "as.factor(RussianGroup)Sanction"][2], adj.p.s2[names(adj.p.s1) %in% "as.factor(RussianGroup)Sanction"][4]), 4)     

c5 <- round(c(coef(main1_s1_inv)["as.factor(RussianGroup)Military"], coef(main2_s1_inv)["as.factor(RussianGroup)Military"],
              coef(main1_s2_inv)["as.factor(RussianGroup)Military"], coef(main2_s2_inv)["as.factor(RussianGroup)Military"]), 2)
p5 <- round(c(summary(main1_s1_inv)$coefficients["as.factor(RussianGroup)Military", 4], summary(main2_s1_inv)$coefficients["as.factor(RussianGroup)Military", 4],
              summary(main1_s2_inv)$coefficients["as.factor(RussianGroup)Military", 4], summary(main2_s2_inv)$coefficients["as.factor(RussianGroup)Military", 4]), 4)
a5 <- round(c(adj.p.s1[names(adj.p.s1) %in% "as.factor(RussianGroup)Military"][2], adj.p.s1[names(adj.p.s1) %in% "as.factor(RussianGroup)Military"][4],
              adj.p.s2[names(adj.p.s1) %in% "as.factor(RussianGroup)Military"][2], adj.p.s2[names(adj.p.s1) %in% "as.factor(RussianGroup)Military"][4]), 4)     

meansB3B <- round(c(mean(experiment1$Military[experiment1$Group == 1], na.rm = TRUE), mean(experiment1$Taiwan[experiment1$Group == 1], na.rm = TRUE),
                    mean(experiment2$Military[experiment2$Group == 1], na.rm = TRUE), mean(experiment2$Taiwan[experiment2$Group == 1], na.rm = TRUE)), 2)
nB3B <- c(nrow(data.sub1), NA,
          nrow(data.sub2), NA)

table.B3B <- rbind(c4, p4, a4,
                   c5, p5, a5, 
                   meansB3B, nB3B)
colnames(table.B3B) <- c("Experiment 1: Use of Force", "Experiment 1: Use of Force Against Taiwan",
                         "Experiment 2: Use of Force", "Experiment 2: Use of Force Against Taiwan")

rownames(table.B3B) <- c("Economic Measures", "p-value", "adjusted p-value",
                         "Military Measures", "p-value", "adjusted p-value",
                         "Baseline Support", "N")

table.B3A
table.B3B

# --------------------------------------------------
# Figure B6
# --------------------------------------------------
experiment1 <- fread("experiment2022.csv")
experiment2 <- fread("experiment2023.csv")

m1d <- mediation.mult.decomp(data1 = experiment1, data2 = experiment2, treatment.value = "Invasion", control.value = "Control", outcome = "Military", legend = 1)
m2d <- mediation.mult.decomp(data1 = experiment1, data2 = experiment2,  treatment.value = "Sanction", control.value = "Control", outcome = "Military", legend = 0)
m3d <- mediation.mult.decomp(data1 = experiment1, data2 = experiment2,  treatment.value = "Military", control.value = "Control", outcome = "Military", legend = 0)
m4d <- mediation.mult.decomp(data1 = experiment1, data2 = experiment2,  treatment.value = "LackMilitary", control.value = "Control", outcome = "Military", legend = 0)
pdf(file = "./Figures_Appendix/Figure_B06.pdf", width = 16, height = 12)
ggarrange(m1d, m2d, m3d, m4d, ncol = 2, nrow = 2)
dev.off()


# --------------------------------------------------
# Figure B7
# --------------------------------------------------
## Mediation with Multiple Mediators
m1 <- mediation.multAll2(data1 = experiment1, data2 = experiment2, treatment.value = "Invasion", control.value = "Control", outcome = "Military", legend = 1)
m2 <- mediation.multAll2(data1 = experiment1, data2 = experiment2, treatment.value = "Sanction", control.value = "Control", outcome = "Military", legend = 0)
m3 <- mediation.multAll2(data1 = experiment1, data2 = experiment2, treatment.value = "Military", control.value = "Control", outcome = "Military", legend = 0)
m4 <- mediation.multAll2(data1 = experiment1, data2 = experiment2, treatment.value = "LackMilitary", control.value = "Control", outcome = "Military", legend = 0)
pdf(file = "./Figures_Appendix/Figure_B07.pdf", width = 14, height = 12)
ggarrange(m1, m2, m3, m4, ncol = 2, nrow = 2)
dev.off()

# --------------------------------------------------
# Figure B8
# --------------------------------------------------
t1d <- mediation.mult.decomp(data1 = experiment1, data2 = experiment2, treatment.value = "Invasion", control.value = "Control", outcome = "Taiwan", legend = 1)
t2d <- mediation.mult.decomp(data1 = experiment1, data2 = experiment2,  treatment.value = "Sanction", control.value = "Control", outcome = "Taiwan", legend = 0)
t3d <- mediation.mult.decomp(data1 = experiment1, data2 = experiment2,  treatment.value = "Military", control.value = "Control", outcome = "Taiwan", legend = 0)
t4d <- mediation.mult.decomp(data1 = experiment1, data2 = experiment2,  treatment.value = "LackMilitary", control.value = "Control", outcome = "Taiwan", legend = 0)
pdf(file = "./Figures_Appendix/Figure_B08.pdf", width = 16, height = 12)
ggarrange(t1d, t2d, t3d, t4d, ncol = 2, nrow = 2)
dev.off()

# --------------------------------------------------
# Figure B9
# --------------------------------------------------
t1 <- mediation.multAll2(data1 = experiment1, data2 = experiment2, treatment.value = "Invasion", control.value = "Control", outcome = "Taiwan", legend = 1)
t2 <- mediation.multAll2(data1 = experiment1, data2 = experiment2, treatment.value = "Sanction", control.value = "Control", outcome = "Taiwan", legend = 0)
t3 <- mediation.multAll2(data1 = experiment1, data2 = experiment2, treatment.value = "Military", control.value = "Control", outcome = "Taiwan", legend = 0)
t4 <- mediation.multAll2(data1 = experiment1, data2 = experiment2, treatment.value = "LackMilitary", control.value = "Control", outcome = "Taiwan", legend = 0)
pdf(file = "./Figures_Appendix/Figure_B09.pdf", width = 14, height = 12)
ggarrange(t1, t2, t3, t4, ncol = 2, nrow = 2)
dev.off()

# --------------------------------------------------
# Figure B10
# --------------------------------------------------
plots.mediation(data = experiment1, treatment = "Invasion", control = "Control", outcome = "Military", exp = 1, filename = "Figure_B10")

# --------------------------------------------------
# Figure B11
# --------------------------------------------------
plots.mediation(data = experiment2, treatment = "Invasion", control = "Control", outcome = "Military", exp = 2, filename = "Figure_B11")

# --------------------------------------------------
# Figure B12
# --------------------------------------------------
plots.mediation(data = experiment1, treatment = "Invasion", control = "Control", outcome = "Taiwan", exp = 1, filename = "Figure_B12")

# --------------------------------------------------
# Figure B13
# --------------------------------------------------
plots.mediation(data = experiment2, treatment = "Invasion", control = "Control", outcome = "Taiwan", exp = 2, filename = "Figure_B13")

# --------------------------------------------------
# Figure C1
# --------------------------------------------------

boe <- function(phi, tau, tau0) {
  res <- ((tau - ((1 - phi) * tau0)))/(phi)
  return(res)
}

## Panel A1
c1A1 <- boe(phi = 0.90, tau0 = 0, tau = 0.17)
c2A1 <- boe(phi = 0.50, tau0 = 0, tau = 0.17)
c3A1 <- boe(phi = 0.10, tau0 = 0, tau = 0.17)

## Panel A2
c1A2 <- boe(phi = 0.90, tau0 = 0, tau = 0.21)
c2A2 <- boe(phi = 0.50, tau0 = 0, tau = 0.21)
c3A2 <- boe(phi = 0.10, tau0 = 0, tau = 0.21)

## Panel B1
c1B1 <- boe(phi = 0.90, tau0 = 0, tau = 0.08)
c2B1 <- boe(phi = 0.50, tau0 = 0, tau = 0.08)
c3B1 <- boe(phi = 0.10, tau0 = 0, tau = 0.08)

## Panel B2
c1B2 <- boe(phi = 0.90, tau0 = 0, tau = 0.18)
c2B2 <- boe(phi = 0.50, tau0 = 0, tau = 0.18)
c3B2 <- boe(phi = 0.10, tau0 = 0, tau = 0.18)

tableC1 <- rbind(c(tau = 0.17, phi = 0.90, tau0 = 0, tau1 = c1A1),
                 c(tau = 0.17, phi = 0.50, tau0 = 0, tau1 = c2A1),
                 c(tau = 0.17, phi = 0.10, tau0 = 0, tau1 = c3A1),
                 c(tau = 0.21, phi = 0.90, tau0 = 0, tau1 = c1A2),
                 c(tau = 0.21, phi = 0.50, tau0 = 0, tau1 = c2A2),
                 c(tau = 0.21, phi = 0.10, tau0 = 0, tau1 = c3A2),
                 c(tau = 0.08, phi = 0.90, tau0 = 0, tau1 = c1B1),
                 c(tau = 0.08, phi = 0.50, tau0 = 0, tau1 = c2B1),
                 c(tau = 0.08, phi = 0.10, tau0 = 0, tau1 = c3B1),
                 c(tau = 0.18, phi = 0.90, tau0 = 0, tau1 = c1B2),
                 c(tau = 0.18, phi = 0.50, tau0 = 0, tau1 = c2B2),
                 c(tau = 0.18, phi = 0.10, tau0 = 0, tau1 = c3B2))
rownames(tableC1) <- c(rep("Experiment 1: Use of Force", 3),
                       rep("Experiment 1: Use of Force Against Taiwan", 3),
                       rep("Experiment 2: Use of Force", 3), 
                       rep("Experiment 2: Use of Force Against Taiwan", 3))
tableC1

# --------------------------------------------------
# Figure C2
# --------------------------------------------------

# Main Regressions:
# Outcome: Support for the Use of Force
main1_s1 <- lm(Military ~ as.factor(RussianGroup), data = experiment1)
main1_s2 <- lm(Military ~ as.factor(RussianGroup), data = experiment2)

# Outcome: Support for the Use of Force Against Taiwan
main2_s1 <- lm(Taiwan ~ as.factor(RussianGroup), data = experiment1)
main2_s2 <- lm(Taiwan ~ as.factor(RussianGroup), data = experiment2)

# Main Regressions adding Age, Education, Gender, and Income (when available)
# Outcome: Support for the Use of Force
main1_s1b <- lm(Military ~ as.factor(RussianGroup) 
               + as.factor(Female) + as.factor(Age_Group)
               + as.factor(Education), data = experiment1)
main1_s2b <- lm(Military ~ as.factor(RussianGroup)
               + as.factor(Female) + as.factor(Age_Group)
               + as.factor(Education) + as.factor(Income), data = experiment2)

# Outcome: Support for the Use of Force Against Taiwan
main2_s1b <- lm(Taiwan ~ as.factor(RussianGroup) 
               + as.factor(Female) + as.factor(Age_Group)
               + as.factor(Education), data = experiment1)
main2_s2b <- lm(Taiwan ~ as.factor(RussianGroup)
               + as.factor(Female) + as.factor(Age_Group)
               + as.factor(Education) + as.factor(Income), data = experiment2)

# Main Regressions adding all covariates
# Outcome: Support for the Use of Force
main1_s1c <- lm(Military ~ as.factor(RussianGroup) 
                + as.factor(Female) + as.factor(Age_Group)
                + as.factor(Education) + as.factor(PartyMember) + as.factor(Pol_Interest)
                + as.factor(Ideology) + as.factor(Nationalism) + as.factor(Social_Media) + as.factor(Foreign) + as.factor(Region), data = experiment1)
main1_s2c <- lm(Military ~ as.factor(RussianGroup)
                + as.factor(Female) + as.factor(Age_Group)
                + as.factor(Education) + as.factor(PartyMember) + as.factor(Pol_Interest)
                + as.factor(Ideology) + as.factor(Nationalism) + as.factor(Social_Media) + as.factor(Foreign) + as.factor(Region) 
                + as.factor(Income), data = experiment2)

# Outcome: Support for the Use of Force Against Taiwan
main2_s1c <- lm(Taiwan ~ as.factor(RussianGroup) 
                + as.factor(Female) + as.factor(Age_Group)
                + as.factor(Education) + as.factor(PartyMember) + as.factor(Pol_Interest)
                + as.factor(Ideology) + as.factor(Nationalism) + as.factor(Social_Media) + as.factor(Foreign) + as.factor(Region), data = experiment1)
main2_s2c <- lm(Taiwan ~ as.factor(RussianGroup)
                + as.factor(Female) + as.factor(Age_Group)
                + as.factor(Education) + as.factor(PartyMember) + as.factor(Pol_Interest)
                + as.factor(Ideology) + as.factor(Nationalism) + as.factor(Social_Media) + as.factor(Foreign) + as.factor(Region)
                + as.factor(Income), data = experiment2)

c1_1 <- round(c(coef(main1_s1)["as.factor(RussianGroup)Invasion"], coef(main2_s1)["as.factor(RussianGroup)Invasion"],
              coef(main1_s2)["as.factor(RussianGroup)Invasion"], coef(main2_s2)["as.factor(RussianGroup)Invasion"]), 2)
p1_1 <- round(c(summary(main1_s1)$coefficients["as.factor(RussianGroup)Invasion", 4], summary(main2_s1)$coefficients["as.factor(RussianGroup)Invasion", 4],
              summary(main1_s2)$coefficients["as.factor(RussianGroup)Invasion", 4], summary(main2_s2)$coefficients["as.factor(RussianGroup)Invasion", 4]), 4)

c2_1 <- round(c(coef(main1_s1)["as.factor(RussianGroup)Sanction"], coef(main2_s1)["as.factor(RussianGroup)Sanction"],
              coef(main1_s2)["as.factor(RussianGroup)Sanction"], coef(main2_s2)["as.factor(RussianGroup)Sanction"]), 2)
p2_1 <- round(c(summary(main1_s1)$coefficients["as.factor(RussianGroup)Sanction", 4], summary(main2_s1)$coefficients["as.factor(RussianGroup)Sanction", 4],
              summary(main1_s2)$coefficients["as.factor(RussianGroup)Sanction", 4], summary(main2_s2)$coefficients["as.factor(RussianGroup)Sanction", 4]), 4)

c3_1 <- round(c(coef(main1_s1)["as.factor(RussianGroup)Military"], coef(main2_s1)["as.factor(RussianGroup)Military"],
              coef(main1_s2)["as.factor(RussianGroup)Military"], coef(main2_s2)["as.factor(RussianGroup)Military"]), 2)
p3_1 <- round(c(summary(main1_s1)$coefficients["as.factor(RussianGroup)Military", 4], summary(main2_s1)$coefficients["as.factor(RussianGroup)Military", 4],
              summary(main1_s2)$coefficients["as.factor(RussianGroup)Military", 4], summary(main2_s2)$coefficients["as.factor(RussianGroup)Military", 4]), 4)

c1_2 <- round(c(coef(main1_s1b)["as.factor(RussianGroup)Invasion"], coef(main2_s1b)["as.factor(RussianGroup)Invasion"],
                coef(main1_s2b)["as.factor(RussianGroup)Invasion"], coef(main2_s2b)["as.factor(RussianGroup)Invasion"]), 2)
p1_2 <- round(c(summary(main1_s1b)$coefficients["as.factor(RussianGroup)Invasion", 4], summary(main2_s1b)$coefficients["as.factor(RussianGroup)Invasion", 4],
                summary(main1_s2b)$coefficients["as.factor(RussianGroup)Invasion", 4], summary(main2_s2b)$coefficients["as.factor(RussianGroup)Invasion", 4]), 4)

c2_2 <- round(c(coef(main1_s1b)["as.factor(RussianGroup)Sanction"], coef(main2_s1b)["as.factor(RussianGroup)Sanction"],
                coef(main1_s2b)["as.factor(RussianGroup)Sanction"], coef(main2_s2b)["as.factor(RussianGroup)Sanction"]), 2)
p2_2 <- round(c(summary(main1_s1b)$coefficients["as.factor(RussianGroup)Sanction", 4], summary(main2_s1b)$coefficients["as.factor(RussianGroup)Sanction", 4],
                summary(main1_s2b)$coefficients["as.factor(RussianGroup)Sanction", 4], summary(main2_s2b)$coefficients["as.factor(RussianGroup)Sanction", 4]), 4)

c3_2 <- round(c(coef(main1_s1b)["as.factor(RussianGroup)Military"], coef(main2_s1b)["as.factor(RussianGroup)Military"],
                coef(main1_s2b)["as.factor(RussianGroup)Military"], coef(main2_s2b)["as.factor(RussianGroup)Military"]), 2)
p3_2 <- round(c(summary(main1_s1b)$coefficients["as.factor(RussianGroup)Military", 4], summary(main2_s1b)$coefficients["as.factor(RussianGroup)Military", 4],
                summary(main1_s2b)$coefficients["as.factor(RussianGroup)Military", 4], summary(main2_s2b)$coefficients["as.factor(RussianGroup)Military", 4]), 4)

c1_3 <- round(c(coef(main1_s1c)["as.factor(RussianGroup)Invasion"], coef(main2_s1c)["as.factor(RussianGroup)Invasion"],
                coef(main1_s2c)["as.factor(RussianGroup)Invasion"], coef(main2_s2c)["as.factor(RussianGroup)Invasion"]), 2)
p1_3 <- round(c(summary(main1_s1c)$coefficients["as.factor(RussianGroup)Invasion", 4], summary(main2_s1b)$coefficients["as.factor(RussianGroup)Invasion", 4],
                summary(main1_s2c)$coefficients["as.factor(RussianGroup)Invasion", 4], summary(main2_s2b)$coefficients["as.factor(RussianGroup)Invasion", 4]), 4)

c2_3 <- round(c(coef(main1_s1c)["as.factor(RussianGroup)Sanction"], coef(main2_s1c)["as.factor(RussianGroup)Sanction"],
                coef(main1_s2c)["as.factor(RussianGroup)Sanction"], coef(main2_s2c)["as.factor(RussianGroup)Sanction"]), 2)
p2_3 <- round(c(summary(main1_s1c)$coefficients["as.factor(RussianGroup)Sanction", 4], summary(main2_s1b)$coefficients["as.factor(RussianGroup)Sanction", 4],
                summary(main1_s2c)$coefficients["as.factor(RussianGroup)Sanction", 4], summary(main2_s2b)$coefficients["as.factor(RussianGroup)Sanction", 4]), 4)

c3_3 <- round(c(coef(main1_s1c)["as.factor(RussianGroup)Military"], coef(main2_s1c)["as.factor(RussianGroup)Military"],
                coef(main1_s2c)["as.factor(RussianGroup)Military"], coef(main2_s2c)["as.factor(RussianGroup)Military"]), 2)
p3_3 <- round(c(summary(main1_s1c)$coefficients["as.factor(RussianGroup)Military", 4], summary(main2_s1c)$coefficients["as.factor(RussianGroup)Military", 4],
                summary(main1_s2c)$coefficients["as.factor(RussianGroup)Military", 4], summary(main2_s2c)$coefficients["as.factor(RussianGroup)Military", 4]), 4)

table.C2A <- rbind(c1_1, p1_1,
                   c2_1, p2_1,
                   c3_1, p3_1)

table.C2B <- rbind(c1_2, p1_2,
                   c2_2, p2_2,
                   c3_2, p3_2)

table.C2C <- rbind(c1_3, p1_3,
                   c2_3, p2_3,
                   c3_3, p3_3)

rownames(table.C2A) <- rownames(table.C2B) <- rownames(table.C2C) <- c("Invasion", "p-value",
                                                                                             "Economic Measures", "p-value",
                                                                                             "Military Measures", "p-value")
                                                                                             
colnames(table.C2A) <-  c("Experiment 1: Use of Force", "Experiment 1: Use of Force Against Taiwan",
                          "Experiment 2: Use of Force", "Experiment 2: Use of Force Against Taiwan")

tableC2 <- rbind(table.C2A, c(rep(NA, 4)), 
                 table.C2B, c(rep(NA, 4)), 
                 table.C2C, c(rep(NA, 4)))
tableC2
